



#ifndef FR508x_AT_H__
#define FR508x_AT_H__

#include <stdint.h>
#include <stdbool.h>

typedef enum 
{
    FR_AT_BASE = 0,
    FR_AT_TEST, 
    
    // 通话相关
    FR_AT_CALL_ANSWER,
    FR_AT_CALL_REJECT,
    FR_AT_CALL_RECALL,
    FR_AT_CALL_DIAL,
    
    // 手机音乐
    FR_AT_MEDIA_PLAY,
    FR_AT_MEDIA_PAUSE,
    FR_AT_MEDIA_PREVIOUS_TRACK,
    FR_AT_MEDIA_NEXT_TRACK,
    FR_AT_MEDIA_VOL_SET,

    // SD卡本地音乐（DAC)
    FR_AT_SD_MEDIA_PLAY,
    FR_AT_SD_MEDIA_PAUSE,
    FR_AT_SD_MEDIA_NEXT_TRACK,
    FR_AT_SD_MEDIA_PREIVOUS_TRACK,
    FR_AT_SD_MEDIA_NUM,
    FR_AT_SD_MEDIA_CURRENT_DETAIL,
    FR_AT_SD_MEDIA_CURRENT_BRIEF,

    // 耳机音乐（source mode)
    FR_AT_TWS_MEDIA_PLAY,
    FR_AT_TWS_MEDIA_PAUSE,
    FR_AT_TWS_MEDIA_NEXT_TRACK,
    FR_AT_TWS_MEDIA_PREVIOUS_TRACK,
        
    // 蓝牙相关
    FR_AT_BT_SCAN_START,
    FR_AT_BT_SCAN_STOP,
    FR_AT_BT_CONNECT,
    FR_AT_BT_CONNECT_LAST,
    FR_AT_BT_DISCONNECT,
    FR_AT_BT_QUERY_STATE,
    FR_AT_BT_CLOSE,
    FR_AT_BT_PAIR_ENABLE,
    FR_AT_BT_QUERY_PEER,      
    FR_AT_BT_CANCEL_CONNECTING, 
    FR_AT_BT_ERASE_PEER, 

    // 电话本
    FR_AT_BT_PBAP_SETUP,
    FR_AT_BT_PBAP_CANCEL,
    FR_AT_BT_PBAP_READ_CONACTS,
    
    

    // MIC相关
    FR_AT_MIC_LOOPBACK_OPEN,
    FR_AT_MIC_LOOPBACK_CLOSE,
    FR_AT_MIC_VOICE_RECORD_OPEN,
    FR_AT_MIC_VOICE_RECORD_CLOSE,

    // 播放提示音
    FR_AT_PLAY_TIPS_SOUND,
    FR_AT_SET_A2DP_VOLUME,
    FR_AT_SET_HF_VOLUME,
    FR_AT_GET_ALL_VOLUME,

    // SIRI控制 
    FR_AT_SIRI_OPEN,
    FR_AT_SIRI_CLOSE,

    // 系统设置
    FR_AT_SYS_AUDIO_SOURCE,
    FR_AT_SYS_AUDIO_SINK,
    FR_AT_SYS_FW_VER,
    FR_AT_SYS_HW_VER,
    
    FR_AT_SYS_BATTERY,
    FR_AT_SYS_MAC,
    FR_AT_READ_IRQ_SOURCE,

    FR_AT_SET_BT_CLOSE, // pwr on & sleep use GPIO to wakeup 
    FR_AT_SET_BT_RESET, 
    FR_AT_SET_UART_CLOSE, // 

    FR_AT_SET_BLE_OPEN,
    FR_AT_SET_BLE_CLOSE,

    // read status int source
    FR_AT_READ_MP3_INFO,
    FR_AT_READ_VOICE_CHANNEL,
    FR_AT_READ_CALL_NUMBER,
    FR_AT_READ_MEDIA_CHANNEL,
    FR_AT_READ_CURRENT_LIST_CALL,
    FR_AT_READ_ALL_VOLUME,
    FR_AT_READ_MUSIC_NAME, 
    FR_AT_READ_DISC_REASON,
}fr508x_at_type_t; 



typedef enum
{
    FR_URC_BASE = 0,
    FR_URC_BT_OPEN,  // power on success
    FR_URC_BT_CLOSE, // power off success
    FR_URC_UART_OPEN,   // sleep to work 
    FR_URC_UART_CLOSE,   // sleep success 

    FR_URC_BT_SCAN_RESULT,
    FR_URC_BT_CONNECTED,
    FR_URC_BT_DISCONNECTED,
    FR_URC_BT_ACCESSIBLE_CHANGE,
    FR_URC_BT_CONN_FAIL, 
    FR_URC_RING,
    FR_URC_INCOMING_CALL_NUMBER,
    FR_URC_DIAL_CALL_NUMBER,
    FR_URC_CALL_ANSWER,
    FR_URC_CALL_HANGUP, 

    FR_URC_VOICE_CHANNEL_CONNECTED,
    FR_URC_VOICE_CHANNEL_DISCONNECTED,

    FR_URC_MEDIA_CHANNEL_CONNECTED,
    FR_URC_MEDIA_CHANNEL_DISCONNECTED,

    FR_URC_MUSIC_CHANGE,
    FR_URC_MUSIC_NAME_TIPS,
    // FR_URC_VOLUME_CHANGE,
    FR_URC_VOLUME_HF_UPDATE,
    FR_URC_VOLUME_AD_UPDATE,
    FR_URC_MP3_DETAIL,
    FR_URC_MP3_BRIEF,
    FR_URC_MP3_NUMS,
    FR_URC_MP3_PROGRESS,
    
    

    FR_URC_PBAP_EVT_UPDATE,
    FR_URC_PBAP_ERROR,    
    FR_URC_PBAP_CONNECT_TIMEOUT,
    FR_URC_PBAP_CONTACTS_UPDATE,  
    FR_URC_PBAP_CONTACTS_PULL_ACK, 
    FR_URC_PBAP_CONTACTS_COMPLETED, 
}fr508x_urc_type_t; 


typedef struct 
{
    uint8_t number[20];
}fr508x_dial_t;

typedef struct
{
    uint8_t number[20];
}fr508x_incomingcall_t;

typedef struct 
{
    uint8_t value; 
}fr508x_volume_t; 

typedef struct
{
    uint8_t volume;
}fr508x_media_vol_t;

typedef struct
{
    uint8_t mac[6];
}fr508x_bt_connect_t;

typedef struct
{
    uint8_t reason; 
}fr508x_bt_disconnect_t;

typedef struct 
{
    uint8_t mac[6];
    int8_t rssi;
    uint8_t namelen;
    uint8_t name[30];
}fr508x_bt_device_t;

typedef struct 
{
    uint8_t state; 
}fr508x_bt_accessible_t;

typedef struct
{
    uint8_t level;
    bool charging; 
}fr508x_battery_t;

typedef struct
{
    uint32_t nums;
}fr508x_mp3_number_t;

typedef struct
{
    uint32_t value; 
}fr508x_mp3_progress_t;

typedef struct
{
    uint8_t len_of_name;
    uint8_t len_of_number;
    uint8_t name[30];
    uint8_t number[20];
}fr508x_contacts_t;


typedef struct
{
    uint32_t timetotal;
    uint8_t len_of_name;
    uint8_t name[35]; 
}fr508x_music_t;


typedef struct 
{
    uint8_t a2dp;
    uint8_t hf;
}fr508x_all_volume_t;

#endif 
